package com.cevent.zhanniu.server.service;/**
 * Created by Cevent on 2020/11/21.
 */

import com.cevent.zhanniu.server.domain.AdminTestEntity;
import com.cevent.zhanniu.server.domain.ZncmsAdmin;
import com.cevent.zhanniu.server.domain.ZncmsAdminExample;
import com.cevent.zhanniu.server.mapper.AdminTestMapper;
import com.cevent.zhanniu.server.mapper.ZncmsAdminMapper;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author cevent
 * @description
 * @date 2020/11/21 9:18
 */
@Service
public class AdminTestService {
    //1.引入mapper
    @Resource
    private AdminTestMapper adminTestMapper;
    @Resource
    private ZncmsAdminMapper zncmsAdminMapper;
    //1.查询admin列表
    public List<AdminTestEntity> testAdminList(){
        return adminTestMapper.test_admin_list();
    }

    //2.查询排序:直接查询实体类，xxxExample为方法接口
    public List<ZncmsAdmin> order_list(){
        ZncmsAdminExample example=new ZncmsAdminExample();
        example.setOrderByClause("id desc");
        return zncmsAdminMapper.selectByExample(example);
    }

    //3.根据id查询
    public List<ZncmsAdmin> selectById(){
        ZncmsAdminExample zncmsAdminExample=new ZncmsAdminExample();
        zncmsAdminExample.createCriteria().andIdEqualTo(3);
        return zncmsAdminMapper.selectByExample(zncmsAdminExample);
    }
}
